home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 24
/
Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso
/
Aminet
/
dev
/
mui
/
mui38dev_bb2.lha
/
EFMUILib
/
Examples
/
EFMenus.asc
< prev
next >
Wrap
Text File
|
1998-02-03
|
9KB
|
273 lines
;(EF) Menus MUI example
;(c)1994 by Stefan Stuntz
;(c)1997/98 by Vivid Imagination
;
;Please note : strange characters instead of shortcuts in SubItem
;are due to a bug into RIGTMenuLib, not into EFMUILib.
;
WBStartup
;** MUI still supports the use of a conventional gadtools NewMenu structure
;** to define a menu strip. The address of this structure is passed to a
;** MUI_MakeObject(MUIO_MenustripNM,newmenu,0) function which creates a complete
;** object tree for this menu and returns a pointer to the menustrip object,
;** This pointer should be placed in a windows MUIA_Window_Menustrip attribute
;** or in an applications MUIA_Application_Menustrip attribute, in which case
;** all windows will inherit the menu. To get direct access to the menu item
;** objects of such an auto generated tree, you can use the MUIM_FindUserData
;** method.
;**
;** You can of course create the menu object tree yourself by defining
;** a menu strip object with some menu object children with some menu
;** item object children with optionally some more menu item object
;** children. In this case, use the MUI_MakeObject(MUIO_Menuitem,...)
;** call to create the menu items if possible.
;**
;** The main program shows some different methods how to create items and
;** how to react on menu items. Choose the one you like best, and don't
;** forget the MUIM_CallHook method if you dislike switch/case in the
;** main loop!
#RB=#CHECKIT
#TG=#CHECKIT|#MENUTOGGLE
#MEN_PROJECT=1
#MEN_ABOUT=2
#MEN_QUIT=3
#MEN_EDIT=4
#MEN_CUT=5
#MEN_COPY=6
#MEN_PASTE=7
#MEN_SETTINGS=8
#MEN_HARDWARE=9
#MEN_A1000=10
#MEN_A2000=11
#MEN_A3000=12
#MEN_A4000=13
#MEN_SOFTWARE=14
#MEN_MUI=15
#MEN_MFR=16
#MEN_MWB=17
#MEN_DFA=18
#ID_ADD=19
#ID_REM=20
#ID_RADIO=21
#ID_TOG=22
GTMenuTitle 0,0,"Project"
GTMenuItem 0,0,0,0,"About","?",0,#MEN_ABOUT
GTMenuItem 0,0,0,1
GTMenuItem 0,0,0,2,"Quit","Q",0,#MEN_QUIT
GTMenuTitle 0,1,"Edit"
GTMenuItem 0,0,1,0,"Cut","X",0,#MEN_CUT
GTMenuItem 0,0,1,1,"Copy","C",0,#MEN_COPY
GTMenuItem 0,0,1,2,"Paste","V",0,#MEN_PASTE
GTMenuTitle 0,2,"Settings"
GTMenuItem 0,#NM_ITEMDISABLED,2,0,"Hardware","",0,#MEN_HARDWARE
GTSubItem 0,#RB|#CHECKED,2,0,0,"A1000","1",2|4|8,#MEN_A1000
GTSubItem 0,#RB,2,0,1,"A2000","2",1|4|8,#MEN_A2000
GTSubItem 0,#RB,2,0,2,"A3000","3",1|2|8,#MEN_A3000
GTSubItem 0,#RB,2,0,3,"A4000","4",1|2|4,#MEN_A4000
GTMenuItem 0,#NM_ITEMDISABLED,2,1,"Software","",0,#MEN_SOFTWARE
GTSubItem 0,#TG,2,1,0,"MUI","M",0,#MEN_MUI
GTSubItem 0,#TG,2,1,1,"MFR","F",0,#MEN_MFR
GTSubItem 0,#TG,2,1,2,"MagicWB","W",0,#MEN_MWB
GTSubItem 0,#TG,2,1,3,"DFA","D",0,#MEN_DFA
running.w=1
addedmisc.w=0
MUIApplicationTitle "Menus"
MUIApplicationVersion "$VER: Menus 19.5 (12.02.97)"
MUIApplicationCopyright "(c)1994 by Stefan Stuntz"
MUIApplicationAuthor "Stefan Stuntz"
MUIApplicationDescription "Demonstrates MUI's menu classes."
MUIApplicationBase "MENU"
MUICycle 1,"Settings disabled","Settings enabled"
MUIAddObjVGroup 0,1
MUICycle 2,"Hardware disabled","Hardware enabled"
MUICycle 3,"Software disabled","Software enabled"
MUIAddTags 4,#MUIA_Group_SameSize,1
MUIAddObjsHGroup 4,2,3
MUICreateHGroup 4
MUIAddObjVGroup 0,4
MUIMakeObject 5,#MUIO_HBar,4,0
MUIAddObjVGroup 0,5
MUIHSpace 6,0
MUIRadio 7,"","Amiga 1000","Amiga 2000","Amiga 3000","Amiga 4000"
MUIHSpace 8,0
MUIMakeObject 9,#MUIO_VBar,1,0
MUIHSpace 10,0
MUILabel 13,"_MUI",0
MUICheckMark 14,0
MUILabel 15,"M_FR",0
MUICheckMark 16,0
MUILabel 17,"Magic_WB",0
MUICheckMark 18,0
MUILabel 19,"_DFA",0
MUICheckMark 20,0
MUIAddTags 11,#MUIA_Group_Columns,2
MUIAddObjsVGroup 11,13,14,15,16,17,18,19,20
MUICreateVGroup 11
MUIHSpace 12,0
For i=6 To 12:MUIAddObjHGroup 21,i:Next
MUICreateHGroup 21
MUIAddObjVGroup 0,21
MUIMakeObject 22,#MUIO_HBar,4,0
MUIAddObjVGroup 0,22
MUISimpleButton 23,"_Add Misc Menu"
MUISimpleButton 24,"_Remove Misc Menu"
MUISimpleButton 25,"_Toggle Misc Titles"
MUIAddObjsHGroup 26,23,24,25
MUIAddTags 26,#MUIA_Group_SameSize,1
MUICreateHGroup 26
MUIAddObjVGroup 0,26
MUICreateVGroup 0
MUICreateMenu 27,0,0,#MEN_PROJECT,#MEN_EDIT,#MEN_SETTINGS
MUISetMenu 30,27
MUICreateWindow 30,"Menus","MEN1",0
MUIAddSubWindow 30
If MUICreateApplication<>True Then End
MUIMakeObject 41,#MUIO_Menuitem,Null("Dynamic"),0,0,0
MUIMakeObject 42,#MUIO_Menuitem,Null("Adding"),0,0,0
MUIMakeObject 43,#MUIO_Menuitem,Null("Of"),0,0,0
MUIMakeObject 44,#MUIO_Menuitem,Null("Items"),0,0,0
MUIMakeObject 45,#MUIO_Menuitem,Null("Is"),0,0,0
MUIMakeObject 46,#MUIO_Menuitem,Null("Possible"),0,#CHECKIT|#CHECKED|#MENUTOGGLE,0
MUIAddTags 40,#MUIA_Menu_Title,Null("Misc")
MUIAddTags 40,#MUIA_Family_Child,MUIObjLoc(41)
MUIAddTags 40,#MUIA_Family_Child,MUIObjLoc(42)
MUIAddTags 40,#MUIA_Family_Child,MUIObjLoc(43)
MUIAddTags 40,#MUIA_Family_Child,MUIObjLoc(44)
MUIAddTags 40,#MUIA_Family_Child,MUIObjLoc(45)
MUIAddTags 40,#MUIA_Family_Child,MUIObjLoc(46)
MUINewObject 40,"Menu.mui",0
MUIFindUData 32,27,#MEN_SETTINGS
MUIFindUData 33,27,#MEN_EDIT
MUIFindUData 34,27,#MEN_HARDWARE
MUIFindUData 35,27,#MEN_SOFTWARE
MUISet 32,#MUIA_Menu_Enabled,0
MUIApplicationObj 31
MUINotify 1,#MUIA_Cycle_Active,#MUIV_EveryTime,32,#MUIM_Set,#MUIA_Menu_Enabled,#MUIV_TriggerValue
MUINotify 2,#MUIA_Cycle_Active,#MUIV_EveryTime,34,#MUIM_Set,#MUIA_Menuitem_Enabled,#MUIV_TriggerValue
MUINotify 3,#MUIA_Cycle_Active,#MUIV_EveryTime,35,#MUIM_Set,#MUIA_Menuitem_Enabled,#MUIV_TriggerValue
MUINotifyApp 23,#MUIA_Pressed,0,#ID_ADD
MUINotifyApp 24,#MUIA_Pressed,0,#ID_REM
MUINotifyApp 25,#MUIA_Pressed,0,#ID_TOG
MUINotify 31,#MUIA_Application_MenuAction,#MEN_A1000,7,#MUIM_Set,#MUIA_Radio_Active,0
MUINotify 31,#MUIA_Application_MenuAction,#MEN_A2000,7,#MUIM_Set,#MUIA_Radio_Active,1
MUINotify 31,#MUIA_Application_MenuAction,#MEN_A3000,7,#MUIM_Set,#MUIA_Radio_Active,2
MUINotify 31,#MUIA_Application_MenuAction,#MEN_A4000,7,#MUIM_Set,#MUIA_Radio_Active,3
MUINotify 14,#MUIA_Selected,#MUIV_EveryTime,27,#MUIM_SetUData,#MEN_MUI,#MUIA_Menuitem_Checked,#MUIV_TriggerValue
MUINotify 16,#MUIA_Selected,#MUIV_EveryTime,27,#MUIM_SetUData,#MEN_MFR,#MUIA_Menuitem_Checked,#MUIV_TriggerValue
MUINotify 18,#MUIA_Selected,#MUIV_EveryTime,27,#MUIM_SetUData,#MEN_MWB,#MUIA_Menuitem_Checked,#MUIV_TriggerValue
MUINotify 20,#MUIA_Selected,#MUIV_EveryTime,27,#MUIM_SetUData,#MEN_DFA,#MUIA_Menuitem_Checked,#MUIV_TriggerValue
MUINotifyApp 7,#MUIA_Radio_Active,#MUIV_EveryTime,#ID_RADIO
MUINotifyApp 30,#MUIA_Window_CloseRequest,1,-1
MUISet 24,#MUIA_Disabled,1
MUISet 14,#MUIA_UserData,#MEN_MUI
MUISet 16,#MUIA_UserData,#MEN_MFR
MUISet 18,#MUIA_UserData,#MEN_MWB
MUISet 20,#MUIA_UserData,#MEN_DFA
MUIOpenWindow 30
Repeat
id.l=MUIWaitEvent
Select id
Case #MEN_QUIT
running=0
Case -1
running=0
Case #MEN_ABOUT
MUIRequest 30,0,"","OK","Some little about window."
Case #ID_ADD
MUISet 23,#MUIA_Disabled,1
MUISet 24,#MUIA_Disabled,0
MUIDoMethod 27,#MUIM_Family_Insert,MUIObjLoc(40),MUIObjLoc(33)
addedmisc=1
Case #ID_REM
MUISet 23,#MUIA_Disabled,0
MUISet 24,#MUIA_Disabled,1
MUIDoMethod 27,#MUIM_Family_Remove,MUIObjLoc(40)
addedmisc=0
Case #ID_TOG
*x.b=MUIGet(40,#MUIA_Menu_Title)
If Peek$(*x)<>"Misc"
MUISet 40,#MUIA_Menu_Title,Null("Misc")
Else
MUISet 40,#MUIA_Menu_Title,Null("Miscodil")
EndIf
*x=MUIGet(46,#MUIA_Menuitem_Title)
If Peek$(*x)<>"Possible"
MUISet 46,#MUIA_Menuitem_Title,Null("Possible")
Else
MUISet 46,#MUIA_Menuitem_Title,Null("elbissoP")
EndIf
Case #MEN_MUI
MUIDoMethod 27,#MUIM_GetUData,id,#MUIA_Menuitem_Checked,&*x
MUIDoMethod 30,#MUIM_SetUData,id,#MUIA_Selected,*x
Case #MEN_MFR
MUIDoMethod 27,#MUIM_GetUData,id,#MUIA_Menuitem_Checked,&*x
MUIDoMethod 30,#MUIM_SetUData,id,#MUIA_Selected,*x
Case #MEN_MWB
MUIDoMethod 27,#MUIM_GetUData,id,#MUIA_Menuitem_Checked,&*x
MUIDoMethod 30,#MUIM_SetUData,id,#MUIA_Selected,*x
Case #MEN_DFA
MUIDoMethod 27,#MUIM_GetUData,id,#MUIA_Menuitem_Checked,&*x
MUIDoMethod 30,#MUIM_SetUData,id,#MUIA_Selected,*x
Case #ID_RADIO
*x=MUIGet(7,#MUIA_Radio_Active)
MUIDoMethod 34,#MUIM_SetUData,#